<!-- html:5 -->
<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
</head>
<body>
	<button id="btn1">保存数据</button>
	<button id="btn2">获取数据</button>
	<button id="btn3">删除数据</button>
	<script>
		btn1.onclick = function() {
			// 浏览器存储
			// 存储数据
			localStorage.setItem('user','张三')
			alert('存储成功')
		}
		btn2.onclick = function() {
			// 获取数据
			const data = localStorage.getItem('user')
			alert(data)
		}
		btn3.onclick = function() {
			// 销毁数据(一个)
			localStorage.removeItem('user')
			// 销毁所有
			// localStorage.clear()
		}
	</script>
</body>
</html>